/* eslint-disable @typescript-eslint/no-explicit-any */
/*
 *  Copyright 2021 Collate
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *  http://www.apache.org/licenses/LICENSE-2.0
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */

 /**
 * 标准信息检测case
 */
export interface Standardtestresult {
    /**
     * Change that lead to this version of the entity.
     */
    changeDescription?: ChangeDescription;
    /**
     * When `true` indicates the entity has been soft deleted.
     */
    deleted?: boolean;
    /**
     * Description of the classification.
     */
    description?: string;
    /**
     * System classifications can't be deleted. Use this flag to disable them.
     */
    disabled?: boolean;
    /**
     * Display Name that identifies this entity.
     */
    displayName?: string;
    /**
     * FullyQualifiedName same as `name`.
     */
    fullyQualifiedName?: string;
    /**
     * Link to the resource corresponding to the classification.
     */
    href?: string;
    /**
     * Unique identifier of this entity instance.
     */
    id?: string;
    /**
     * Tags under this classification are mutually exclusive. When mutually exclusive is `true`
     * the tags from this classification are used to **classify** an entity. An entity can only
     * be in one class - example, it can only be either `tier1` or `tier2` and not both. When
     * mutually exclusive is `false`, the tags from this classification are used to
     * **categorize** an entity. An entity have multiple tags simultaneously - example a
     * customer can be `newCustomer` and `atRisk` simultaneously.
     */
    mutuallyExclusive?: boolean;
    name:               string;
    provider?:          ProviderType;
    /**
     * 测试用例结果的详细信息
     */
    result?: string;
    /**
     * 用于捕获未匹配指定测试用例的行/列的示例数据
     */
    sampleData?: string;
    /**
     * Total number of children tag terms under this classification. This includes all the
     * children in the hierarchy.
     */
    termCount?: number;
    /**
     * 用于捕获测试用例结果的模式
     */
    testCaseFailureStatus?: TestCaseFailureStatus;
    /**
     * 测试用例运行的状态
     */
    testCaseStatus:   StandardTestStatus;
    testResultValue?: TestResultValue[];
    /**
     * 获取测试用例结果的日期
     */
    timestamp: number;
    /**
     * Last update time corresponding to the new version of the entity in Unix epoch time
     * milliseconds.
     */
    updatedAt?: number;
    /**
     * User who made the update.
     */
    updatedBy?: string;
    /**
     * Count of how many times the tags from this classification are used.
     */
    usageCount?: number;
    /**
     * Metadata version of the entity.
     */
    version?: number;
}

/**
 * Change that lead to this version of the entity.
 *
 * Description of the change.
 */
export interface ChangeDescription {
    /**
     * Names of fields added during the version changes.
     */
    fieldsAdded?: FieldChange[];
    /**
     * Fields deleted during the version changes with old value before deleted.
     */
    fieldsDeleted?: FieldChange[];
    /**
     * Fields modified during the version changes with old and new values.
     */
    fieldsUpdated?: FieldChange[];
    /**
     * When a change did not result in change, this could be same as the current version.
     */
    previousVersion?: number;
}

export interface FieldChange {
    /**
     * Name of the entity field that changed.
     */
    name?: string;
    /**
     * New value of the field. Note that this is a JSON string and use the corresponding field
     * type to deserialize it.
     */
    newValue?: any;
    /**
     * Previous value of the field. Note that this is a JSON string and use the corresponding
     * field type to deserialize it.
     */
    oldValue?: any;
}

/**
 * Type of provider of an entity. Some entities are provided by the `system`. Some are
 * entities created and provided by the `user`. Typically `system` provide entities can't be
 * deleted and can only be disabled.
 */
export enum ProviderType {
    System = "system",
    User = "user",
}

/**
 * 用于捕获测试用例结果的模式
 */
export interface TestCaseFailureStatus {
    /**
     * 测试用例失败解决的评论
     */
    testCaseFailureComment?: string;
    /**
     * 测试用例解决的原因
     */
    testCaseFailureReason?: TestCaseFailureReason;
    /**
     * 测试用例确认的状态
     */
    testCaseFailureStatusType?: TestCaseFailureStatusType;
    /**
     * 更新测试用例失败状态的时间
     */
    updatedAt?: number;
    /**
     * 更新测试用例失败状态的用户
     */
    updatedBy?: string;
    [property: string]: any;
}

/**
 * 测试用例解决的原因
 */
export enum TestCaseFailureReason {
    Duplicates = "Duplicates",
    FalsePositive = "FalsePositive",
    MissingData = "MissingData",
    Other = "Other",
    OutOfBounds = "OutOfBounds",
}

/**
 * 测试用例确认的状态
 */
export enum TestCaseFailureStatusType {
    ACK = "Ack",
    New = "New",
    Resolved = "Resolved",
}

/**
 * 测试用例运行的状态
 *
 * 标准用例运行的状态
 */
export enum StandardTestStatus {
    Failed = "Failed",
    PartialSuccess = "PartialSuccess",
    Success = "Success",
}

/**
 * 用于捕获测试用例结果值的模式
 */
export interface TestResultValue {
    /**
     * 值的名称
     */
    name?: string;
    /**
     * 值的名称
     */
    showName?: string;
    /**
     * 测试结果值
     */
    value?: string;
    [property: string]: any;
}
